//
//  shopGiftView.m
//  ILiangCang
//
//  Created by ZX on 16-4-16.
//  Copyright (c) 2016年 CRQ. All rights reserved.
//

#import "shopGiftView.h"

#define WIDTH [UIScreen mainScreen].bounds.size.width
#define HEIGHT [UIScreen mainScreen].bounds.size.height
@implementation shopGiftView

/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/
-(id)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self)
    {
        
        UIScrollView * scroll = [[UIScrollView alloc]initWithFrame:self.frame];
        scroll.backgroundColor = [UIColor whiteColor];
        scroll.contentSize = CGSizeMake(WIDTH, WIDTH/3*5.5);
        scroll.showsHorizontalScrollIndicator = NO;
        scroll.showsVerticalScrollIndicator = NO;
        [self addSubview:scroll];
        UIButton * bigBtn = [UIButton buttonWithType:UIButtonTypeSystem];
        bigBtn.frame = CGRectMake(0, 0, WIDTH, WIDTH/3*2);
        bigBtn.tag = 7;
        [bigBtn setBackgroundImage:[UIImage imageNamed:@"banner01"] forState:UIControlStateNormal];
        [bigBtn addTarget:self action:@selector(btnClick:) forControlEvents:UIControlEventTouchUpInside];
        [scroll addSubview:bigBtn];
        
        
        for (int i=0; i<6; i++)
        {
            UIButton * btn = [UIButton buttonWithType:UIButtonTypeSystem];
            btn.frame = CGRectMake(WIDTH/3*(i%3), WIDTH/3*(i/3)+WIDTH/3*2,WIDTH/3,WIDTH/3);
            btn.tag = i+1;
            UIImageView * image = [[UIImageView alloc]init];
            NSString * str = [NSString stringWithFormat:@"fenlei%d",i+1];
            image.image = [UIImage imageNamed:str];
            [btn setBackgroundImage:image.image forState:UIControlStateNormal];
            [btn addTarget:self action:@selector(btnClick:) forControlEvents:UIControlEventTouchUpInside];
            [scroll addSubview:btn];
            
        }
        
        

    }
    
    return self;
}

-(void)btnClick:(UIButton *)sender
{
    
    
}


@end
